{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyspark import SparkContext\n",
    "from pyspark import SparkConf\n",
    "from pyspark.sql import SparkSession\n",
    "from pyspark.sql import SQLContext\n",
    "from pyspark.sql import DataFrame\n",
    "from pyspark.sql import Row"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# spark 路径\n",
    "sparkpath = \"spark://127.0.0.1:7077\"\n",
    "# hdfs 路径\n",
    "hdfspath = 'hdfs://127.0.0.1:9000'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 配置连接spark\n",
    "spark = SparkSession.builder.master(\"local[*]\").appName(\"xmgjyh_yxx\").getOrCreate()\n",
    "sc = spark.sparkContext\n",
    "sqlContext = SQLContext(sparkContext=sc)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_all_features = spark.read.csv(hdfspath + '/qiye/all_features.csv',sep=',',header=True)  # 格式问题，以text形式读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_train = spark.read.csv(hdfspath + '/qiye/ljt_train_sample_csv20150101_20171230.csv',sep=',',header=True)  # 格式问题，以text形式读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+------------------------------------+------------+-------------------+---------------------+---------------------+-------------------+---------------+--------------+--------------------+----------------------+----------------------+--------------------+-----------------------+-------------------------+-------------------------+-----------------------+----+----+---------------+---------------+----------------+----------------+--------+-------+-------------+-------------+--------------+--------------+----------+------+-----+------------+---------------+----------------+----------------+--------+-------+--------------+-----------------+------------------+------------------+----------+---------+----------------+-------------------+--------------------+--------------------+------------+-----------+----------------------+---------------------------------+-----------------------------+-----------------------------+-----------------------+---------------------------+----------------------+-----------------------+----------------------------------+------------------------------+------------------------------+------------------------+----------------------------+-----------------------+-------------------+------------------------------+--------------------------+\n",
      "|                             company|shixin_label|share_frost_all_cnt|share_frost_upper_cnt|share_frost_lower_cnt|share_frost_cnt_coc|share_frost_rhl|share_frost_cv|share_impawn_all_cnt|share_impawn_upper_cnt|share_impawn_lower_cnt|share_impawn_cnt_coc|shares_transfer_all_cnt|shares_transfer_upper_cnt|shares_transfer_lower_cnt|shares_transfer_cnt_coc|zczj|clnx|clnx_shixin_cnt|clnx_fw_all_cnt|clnx_normal_rate|clnx_shixin_rate|clnx_woe|clnx_iv|hy_normal_cnt|hy_shixin_cnt|hy_normal_rate|hy_shixin_rate|hy_all_cnt|hy_woe|hy_iv|zczj_all_cnt|zczj_shixin_cnt|zczj_normal_rate|zczj_shixin_rate|zczj_woe|zczj_iv|zczjbz_all_cnt|zczjbz_shixin_cnt|zczjbz_normal_rate|zczjbz_shixin_rate|zczjbz_woe|zczjbz_iv|province_all_cnt|province_shixin_cnt|province_normal_rate|province_shixin_rate|province_woe|province_iv|net_share_judgedoc_cnt|net_share_judge_defendant_all_cnt|net_share_judge_doc_upper_cnt|net_share_judge_doc_lower_cnt|net_share_judge_doc_rhl|net_share_judge_doc_cnt_coc|net_share_judge_doc_cv|net_senior_judgedoc_cnt|net_senior_judge_defendant_all_cnt|net_senior_judge_doc_upper_cnt|net_senior_judge_doc_lower_cnt|net_senior_judge_doc_rhl|net_senior_judge_doc_cnt_coc|net_senior_judge_doc_cv|net_fr_judgedoc_cnt|net_fr_judge_defendant_all_cnt|net_fr_judge_doc_upper_cnt|\n",
      "+------------------------------------+------------+-------------------+---------------------+---------------------+-------------------+---------------+--------------+--------------------+----------------------+----------------------+--------------------+-----------------------+-------------------------+-------------------------+-----------------------+----+----+---------------+---------------+----------------+----------------+--------+-------+-------------+-------------+--------------+--------------+----------+------+-----+------------+---------------+----------------+----------------+--------+-------+--------------+-----------------+------------------+------------------+----------+---------+----------------+-------------------+--------------------+--------------------+------------+-----------+----------------------+---------------------------------+-----------------------------+-----------------------------+-----------------------+---------------------------+----------------------+-----------------------+----------------------------------+------------------------------+------------------------------+------------------------+----------------------------+-----------------------+-------------------+------------------------------+--------------------------+\n",
      "|          无锡东灵汇医用技术有限公司|           1|               null|                 null|                 null|               null|           null|          null|                null|                  null|                  null|                null|                   null|                     null|                     null|                   null|null|null|           null|           null|            null|            null|    null|   null|         null|         null|          7340|            js| 20.000000|     0|    7|           1|              0|               0|               0|       0|      0|             0|                0|                 0|                 0|         0|        0|               0|                  0|                   0|                   0|           0|          0|                     0|                                0|                            0|                            0|                      0|                          0|                     0|                      0|                                 0|                             0|                             0|                       0|                           0|                      0|                  0|                             0|                         0|\n",
      "|无锡买卖宝信息技术有限公司北京分公司|           1|               null|                 null|                 null|               null|           null|          null|                null|                  null|                  null|                null|                   null|                     null|                     null|                   null|null|null|           null|           null|            null|            null|    null|   null|         null|         null|          6599|            bj|  0.000000|   156|    8|           0|              0|               0|               0|       0|      0|             0|                0|                 0|                 0|         0|        0|               0|                  0|                   0|                   0|           0|          0|                     0|                                0|                            0|                            0|                      0|                          0|                     0|                      0|                                 0|                             0|                             0|                       0|                           0|                      0|                  0|                            13|                      4.33|\n",
      "+------------------------------------+------------+-------------------+---------------------+---------------------+-------------------+---------------+--------------+--------------------+----------------------+----------------------+--------------------+-----------------------+-------------------------+-------------------------+-----------------------+----+----+---------------+---------------+----------------+----------------+--------+-------+-------------+-------------+--------------+--------------+----------+------+-----+------------+---------------+----------------+----------------+--------+-------+--------------+-----------------+------------------+------------------+----------+---------+----------------+-------------------+--------------------+--------------------+------------+-----------+----------------------+---------------------------------+-----------------------------+-----------------------------+-----------------------+---------------------------+----------------------+-----------------------+----------------------------------+------------------------------+------------------------------+------------------------+----------------------------+-----------------------+-------------------+------------------------------+--------------------------+\n",
      "only showing top 2 rows\n",
      "\n"
     ]
    }
   ],
   "source": [
    "df_all_features.show(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['company', 'shixin_label', 'share_frost_all_cnt', 'share_frost_upper_cnt', 'share_frost_lower_cnt', 'share_frost_cnt_coc', 'share_frost_rhl', 'share_frost_cv', 'share_impawn_all_cnt', 'share_impawn_upper_cnt', 'share_impawn_lower_cnt', 'share_impawn_cnt_coc', 'shares_transfer_all_cnt', 'shares_transfer_upper_cnt', 'shares_transfer_lower_cnt', 'shares_transfer_cnt_coc', 'zczj', 'clnx', 'clnx_shixin_cnt', 'clnx_fw_all_cnt', 'clnx_normal_rate', 'clnx_shixin_rate', 'clnx_woe', 'clnx_iv', 'hy_normal_cnt', 'hy_shixin_cnt', 'hy_normal_rate', 'hy_shixin_rate', 'hy_all_cnt', 'hy_woe', 'hy_iv', 'zczj_all_cnt', 'zczj_shixin_cnt', 'zczj_normal_rate', 'zczj_shixin_rate', 'zczj_woe', 'zczj_iv', 'zczjbz_all_cnt', 'zczjbz_shixin_cnt', 'zczjbz_normal_rate', 'zczjbz_shixin_rate', 'zczjbz_woe', 'zczjbz_iv', 'province_all_cnt', 'province_shixin_cnt', 'province_normal_rate', 'province_shixin_rate', 'province_woe', 'province_iv', 'net_share_judgedoc_cnt', 'net_share_judge_defendant_all_cnt', 'net_share_judge_doc_upper_cnt', 'net_share_judge_doc_lower_cnt', 'net_share_judge_doc_rhl', 'net_share_judge_doc_cnt_coc', 'net_share_judge_doc_cv', 'net_senior_judgedoc_cnt', 'net_senior_judge_defendant_all_cnt', 'net_senior_judge_doc_upper_cnt', 'net_senior_judge_doc_lower_cnt', 'net_senior_judge_doc_rhl', 'net_senior_judge_doc_cnt_coc', 'net_senior_judge_doc_cv', 'net_fr_judgedoc_cnt', 'net_fr_judge_defendant_all_cnt', 'net_fr_judge_doc_upper_cnt']\n",
      "['shixin_label', 'share_frost_all_cnt', 'share_frost_upper_cnt', 'share_frost_lower_cnt', 'share_frost_cnt_coc', 'share_frost_rhl', 'share_frost_cv', 'share_impawn_all_cnt', 'share_impawn_upper_cnt', 'share_impawn_lower_cnt', 'share_impawn_cnt_coc', 'shares_transfer_all_cnt', 'shares_transfer_upper_cnt', 'shares_transfer_lower_cnt', 'shares_transfer_cnt_coc', 'zczj', 'clnx', 'clnx_shixin_cnt', 'clnx_fw_all_cnt', 'clnx_normal_rate', 'clnx_shixin_rate', 'clnx_woe', 'clnx_iv', 'hy_normal_cnt', 'hy_shixin_cnt', 'hy_normal_rate', 'hy_shixin_rate', 'hy_all_cnt', 'hy_woe', 'hy_iv', 'zczj_all_cnt', 'zczj_shixin_cnt', 'zczj_normal_rate', 'zczj_shixin_rate', 'zczj_woe', 'zczj_iv', 'zczjbz_all_cnt', 'zczjbz_shixin_cnt', 'zczjbz_normal_rate', 'zczjbz_shixin_rate', 'zczjbz_woe', 'zczjbz_iv', 'province_all_cnt', 'province_shixin_cnt', 'province_normal_rate', 'province_shixin_rate', 'province_woe', 'province_iv', 'net_share_judgedoc_cnt', 'net_share_judge_defendant_all_cnt', 'net_share_judge_doc_upper_cnt', 'net_share_judge_doc_lower_cnt', 'net_share_judge_doc_rhl', 'net_share_judge_doc_cnt_coc', 'net_share_judge_doc_cv', 'net_senior_judgedoc_cnt', 'net_senior_judge_defendant_all_cnt', 'net_senior_judge_doc_upper_cnt', 'net_senior_judge_doc_lower_cnt', 'net_senior_judge_doc_rhl', 'net_senior_judge_doc_cnt_coc', 'net_senior_judge_doc_cv', 'net_fr_judgedoc_cnt', 'net_fr_judge_defendant_all_cnt', 'net_fr_judge_doc_upper_cnt', 'net_fr_judge_doc_lower_cnt', 'net_fr_judge_doc_rhl', 'net_fr_judge_doc_cnt_coc', 'net_fr_judge_doc_cv', 'net_invest_judgedoc_cnt', 'net_invest_judge_defendant_all_cnt', 'net_invest_judge_doc_upper_cnt', 'net_invest_judge_doc_lower_cnt', 'net_invest_judge_doc_rhl', 'net_invest_judge_doc_cnt_coc', 'net_invest_judge_doc_cv', 'litigant_defendant_cnt_coc', 'litigant_defendant_contract_dispute_cnt_coc', 'litigant_defendant_bust_cnt_coc', 'litigant_defendant_unjust_enrich_cnt_coc', 'litigant_defendant_infringe_cnt_coc', 'litigant_defendant_cnt', 'litigant_defendant_contract_dispute_cnt', 'litigant_defendant_bust_cnt', 'litigant_defendant_unjust_enrich_cnt', 'litigant_defendant_infringe_cnt', 'litigant_defendant_cnt_rhl', 'litigant_defendant_cnt_cv', 'litigant_defendant_contract_dispute_cnt_rhl', 'litigant_defendant_contract_dispute_cnt_cv', 'litigant_defendant_bust_cnt_rhl', 'litigant_defendant_bust_cnt_cv', 'litigant_defendant_unjust_enrich_cnt_rhl', 'litigant_defendant_unjust_enrich_cnt_cv', 'litigant_defendant_infringe_cnt_rhl', 'litigant_defendant_infringe_cnt_cv', 'network_shixin_cnt_coc', 'network_fr_shixin_cnt_coc', 'network_pos_shixin_cnt_coc', 'network_share_shixin_cnt_coc', 'network_company_shixin_cnt_coc', 'network_shixin_cnt', 'network_fr_shixin_cnt', 'network_pos_shixin_cnt', 'network_share_shixin_cnt', 'network_company_shixin_cnt', 'network_shixin_cnt_rhl', 'network_shixin_cnt_cv', 'network_fr_shixin_cnt_rhl', 'network_fr_shixin_cnt_cv', 'network_pos_shixin_cnt_rhl', 'network_pos_shixin_cnt_cv', 'network_share_shixin_cnt_rhl', 'network_share_shixin_cnt_cv', 'network_company_shixin_cnt_rhl', 'network_company_shixin_cnt_cv', 'network_zhixing_cnt_coc', 'network_fr_zhixing_cnt_coc', 'network_pos_zhixing_cnt_coc', 'network_share_zhixing_cnt_coc', 'network_company_zhixing_cnt_coc', 'network_zhixing_cnt', 'network_fr_zhixing_cnt', 'network_pos_zhixing_cnt', 'network_share_zhixing_cnt', 'network_company_zhixing_cnt', 'network_zhixing_cnt_rhl', 'network_zhixing_cnt_cv', 'network_fr_zhixing_cnt_rhl', 'network_fr_zhixing_cnt_cv', 'network_pos_zhixing_cnt_rhl', 'network_pos_zhixing_cnt_cv', 'network_share_zhixing_cnt_rhl', 'network_share_zhixing_cnt_cv', 'network_company_zhixing_cnt_rhl', 'network_company_zhixing_cnt_cv', 'punish_warn_cnt_coc', 'punish_fine_cnt_coc', 'punish_illicit_competition_cnt_coc', 'punish_trademark_infringe_cnt_coc', 'punish_warn_cnt', 'punish_fine_cnt', 'punish_illicit_competition_cnt', 'punish_trademark_infringe_cnt', 'punish_warn_cnt_rhl', 'punish_warn_cnt_cv', 'punish_fine_cnt_rhl', 'punish_fine_cnt_cv', 'punish_illicit_competition_cnt_rhl', 'punish_illicit_competition_cnt_cv', 'punish_trademark_infringe_cnt_rhl', 'punish_trademark_infringe_cnt_cv', 'regcap_change_cnt_coc', 'share_change_cnt_coc', 'address_change_cnt_coc', 'fr_change_cnt2_coc', 'regcap_change_cnt', 'share_change_cnt', 'address_change_cnt', 'fr_change_cnt', 'regcap_change_cnt_rhl', 'regcap_change_cnt_cv', 'share_change_cnt_rhl', 'share_change_cnt_cv', 'address_change_cnt_rhl', 'address_change_cnt_cv', 'fr_change_cnt_rhl', 'fr_change_cnt_cv']\n"
     ]
    }
   ],
   "source": [
    "print(df_all_features.columns)\n",
    "print(df_train.columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_all_features.createOrReplaceTempView(\"features\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "dxFeature = ['shixin_label','litigant_defendant_cnt', 'zczj', 'net_share_judge_doc_upper_cnt', 'province_shixin_cnt', 'province_woe', 'hy_normal_cnt', 'net_share_judgedoc_cnt', 'hy_normal_rate', 'litigant_defendant_cnt_coc', 'net_fr_judge_doc_upper_cnt', 'net_fr_judge_doc_cnt_coc', 'network_shixin_cnt_coc', 'network_zhixing_cnt_coc', 'net_senior_judge_doc_upper_cnt', 'litigant_defendant_cnt_rhl', 'share_change_cnt_coc', 'fr_change_cnt', 'net_share_judge_defendant_all_cnt', 'network_shixin_cnt', 'share_frost_cv', 'net_share_judge_doc_lower_cnt', 'clnx', 'net_share_judge_doc_cnt_coc', 'network_fr_shixin_cnt_cv', 'network_fr_shixin_cnt', 'net_share_judge_doc_rhl', 'province_all_cnt', 'network_fr_zhixing_cnt', 'network_pos_zhixing_cnt', 'network_pos_shixin_cnt', 'network_share_shixin_cnt_cv', 'regcap_change_cnt', 'share_frost_lower_cnt', 'litigant_defendant_cnt_cv', 'zczj_shixin_cnt', 'clnx_woe', 'net_share_judge_doc_cv', 'net_fr_judge_defendant_all_cnt', 'net_senior_judgedoc_cnt', 'network_share_zhixing_cnt', 'network_zhixing_cnt_rhl', 'net_invest_judge_doc_rhl', 'regcap_change_cnt_coc', 'net_fr_judgedoc_cnt', 'network_zhixing_cnt', 'network_fr_zhixing_cnt_cv', 'address_change_cnt_cv', 'network_share_shixin_cnt', 'share_change_cnt', 'regcap_change_cnt_rhl', 'net_senior_judge_doc_lower_cnt', 'share_change_cnt_cv', 'fr_change_cnt_cv', 'network_share_zhixing_cnt_cv', 'address_change_cnt_coc', 'regcap_change_cnt_cv', 'share_change_cnt_rhl', 'clnx_fw_all_cnt', 'network_company_shixin_cnt', 'network_pos_shixin_cnt_coc', 'network_fr_shixin_cnt_rhl', 'network_company_zhixing_cnt', 'network_company_zhixing_cnt_cv', 'network_pos_zhixing_cnt_coc', 'zczj_woe']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_train01  =df_train[dxFeature]\n",
    "df_train01.createOrReplaceTempView(\"train\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "df02 = spark.sql(\"\"\" WITH\n",
    "                   f AS\n",
    "                     (select f.company, f.shixin_label from features f where f.company !=\"\" and  f.shixin_label!=\"\"),\n",
    "                   t AS\n",
    "                     (SELECT  t.* from  train t  where  t.shixin_label!=\"\" )\n",
    "                 SELECT  f.company, t.*  FROM f LEFT JOIN t on t.shixin_label=f.shixin_label limit 1000\n",
    " \"\"\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+--------------------------+------------+----------------------+------------+-----------------------------+-------------------+------------+-------------+----------------------+--------------+--------------------------+--------------------------+------------------------+----------------------+-----------------------+------------------------------+--------------------------+--------------------+-------------+---------------------------------+------------------+--------------+-----------------------------+----+---------------------------+------------------------+---------------------+-----------------------+----------------+----------------------+-----------------------+----------------------+---------------------------+-----------------+---------------------+-------------------------+---------------+-------------------+----------------------+------------------------------+-----------------------+-------------------------+-----------------------+------------------------+---------------------+-------------------+-------------------+-------------------------+---------------------+------------------------+----------------+---------------------+------------------------------+-------------------+------------------+----------------------------+----------------------+--------------------+--------------------+---------------+--------------------------+--------------------------+-------------------------+---------------------------+------------------------------+---------------------------+-------------------+\n",
      "|                   company|shixin_label|litigant_defendant_cnt|        zczj|net_share_judge_doc_upper_cnt|province_shixin_cnt|province_woe|hy_normal_cnt|net_share_judgedoc_cnt|hy_normal_rate|litigant_defendant_cnt_coc|net_fr_judge_doc_upper_cnt|net_fr_judge_doc_cnt_coc|network_shixin_cnt_coc|network_zhixing_cnt_coc|net_senior_judge_doc_upper_cnt|litigant_defendant_cnt_rhl|share_change_cnt_coc|fr_change_cnt|net_share_judge_defendant_all_cnt|network_shixin_cnt|share_frost_cv|net_share_judge_doc_lower_cnt|clnx|net_share_judge_doc_cnt_coc|network_fr_shixin_cnt_cv|network_fr_shixin_cnt|net_share_judge_doc_rhl|province_all_cnt|network_fr_zhixing_cnt|network_pos_zhixing_cnt|network_pos_shixin_cnt|network_share_shixin_cnt_cv|regcap_change_cnt|share_frost_lower_cnt|litigant_defendant_cnt_cv|zczj_shixin_cnt|           clnx_woe|net_share_judge_doc_cv|net_fr_judge_defendant_all_cnt|net_senior_judgedoc_cnt|network_share_zhixing_cnt|network_zhixing_cnt_rhl|net_invest_judge_doc_rhl|regcap_change_cnt_coc|net_fr_judgedoc_cnt|network_zhixing_cnt|network_fr_zhixing_cnt_cv|address_change_cnt_cv|network_share_shixin_cnt|share_change_cnt|regcap_change_cnt_rhl|net_senior_judge_doc_lower_cnt|share_change_cnt_cv|  fr_change_cnt_cv|network_share_zhixing_cnt_cv|address_change_cnt_coc|regcap_change_cnt_cv|share_change_cnt_rhl|clnx_fw_all_cnt|network_company_shixin_cnt|network_pos_shixin_cnt_coc|network_fr_shixin_cnt_rhl|network_company_zhixing_cnt|network_company_zhixing_cnt_cv|network_pos_zhixing_cnt_coc|           zczj_woe|\n",
      "+--------------------------+------------+----------------------+------------+-----------------------------+-------------------+------------+-------------+----------------------+--------------+--------------------------+--------------------------+------------------------+----------------------+-----------------------+------------------------------+--------------------------+--------------------+-------------+---------------------------------+------------------+--------------+-----------------------------+----+---------------------------+------------------------+---------------------+-----------------------+----------------+----------------------+-----------------------+----------------------+---------------------------+-----------------+---------------------+-------------------------+---------------+-------------------+----------------------+------------------------------+-----------------------+-------------------------+-----------------------+------------------------+---------------------+-------------------+-------------------+-------------------------+---------------------+------------------------+----------------+---------------------+------------------------------+-------------------+------------------+----------------------------+----------------------+--------------------+--------------------+---------------+--------------------------+--------------------------+-------------------------+---------------------------+------------------------------+---------------------------+-------------------+\n",
      "|无锡东灵汇医用技术有限公司|           1|                     1|   25.000000|                          0.0|              22455|   4.9815655|       192910|                    14|          3426|                       0.0|                      null|                    null|                   0.0|                    0.0|                           0.0|                      36.0|                 0.0|            1|                                2|               1.0|          null|                         14.0|12.0|                        0.0|                     1.0|                  0.0|     0.8571426666666667|         2822163|                   0.0|                    0.0|                   0.0|                        0.0|                0|                 null|                      0.0|          17794|-1.2206575811771097|   0.42857133333333336|                          null|                      7|                      1.0|                   36.0|                    null|                  0.0|               null|                1.0|                      1.0|                  1.0|                     1.0|               0|                  0.0|                           7.0|                1.0|              18.0|                         0.0|                   0.0|                 1.0|                 0.0|        4103782|                       0.0|                      -0.0|                      0.0|                        0.0|                           1.0|                       -0.0| 1.5075852841431339|\n",
      "|无锡东灵汇医用技术有限公司|           1|                    35|30000.000000|                        105.0|              22455|   4.9815655|        89753|                   159|          1187|        0.5909090909090909|                      55.0|                0.272998|    0.7368421052631579|     1.2291666666666667|                           2.0|         5.142857142857143|                -1.0|            0|                              145|              33.0|      0.560401|                        104.0|15.3|        0.44567119999999993|      1.8856180831641265|                 12.0|              0.3330563|         2822163|                  81.0|                    8.0|                   0.0|          1.885618083164127|                0|                   10|       1.3876451021259486|           5821|-1.6246709137592923|             0.1519177|                            75|                      9|                     81.0|       3.02803738317757|                     0.0|                  0.0|                 85|              214.0|       1.3329071298948139|                  1.0|                    12.0|               1|                  0.0|                           7.0|               18.0|               1.0|          1.3329071298948132|                   0.0|                 1.0|                36.0|        2380664|                       9.0|                      -0.0|                      6.0|                       44.0|             1.361941923935953|                        3.0|-0.8242069996459394|\n",
      "|无锡东灵汇医用技术有限公司|           1|                  null|  100.000000|                         26.0|              43926|    8.642053|        43912|                    67|           591|                      null|                      26.0|     0.22608679999999998|                   0.0|    0.45454545454545453|                          null|                      null|                null|         null|                               34|              10.0|          null|                         55.0|13.1|        0.22608679999999998|                     3.6|                  5.0|              0.2896552|         5074126|                  31.0|                    1.0|                   0.0|                        3.6|             null|                 null|                     null|          58210|-1.5896117497896884|             0.1365448|                            34|                   null|                     32.0|                 2.8125|                    null|                 null|                 67|               64.0|        1.539910967341576|                 null|                     5.0|            null|                 null|                          null|               null|              null|           1.506262437496283|                  null|                null|                null|        2687417|                       0.0|                      -0.0|                      7.2|                        0.0|                           1.0|                        0.0| 1.9411544725836023|\n",
      "|无锡东灵汇医用技术有限公司|           1|                     6|   10.000000|                         24.0|              43926|    8.642053|      2423325|                    32|         41111|                       0.0|                       6.0|                     0.5|                  null|                   null|                           6.0|                      12.0|                null|         null|                               32|              null|          null|                         24.0| 6.3|                        0.8|                    null|                 null|                    1.2|         5074126|                  null|                   null|                  null|                       null|             null|                 null|        5.196152422706631|          21704|-1.7040155830875625|                   0.6|                             8|                      8|                     null|                   null|                    null|                 null|                  8|               null|                     null|                 null|                    null|            null|                 null|                           6.0|               null|              null|                        null|                  null|                null|                null|        4402233|                      null|                      null|                     null|                       null|                          null|                       null| 0.8321690046279183|\n",
      "|无锡东灵汇医用技术有限公司|           1|                     3|   60.000000|                          0.0|              51359|  -1.6368496|       556067|                     3|         13351|                       0.0|                      null|                    null|                   0.0|                    0.0|                           0.0|                      12.0|                 0.0|            1|                                3|               1.0|          null|                          3.0|16.3|                        0.0|                     1.0|                  0.0|                    0.5|         2895176|                   0.0|                    1.0|                   1.0|                        1.0|                0|                 null|                      0.0|          58210|-1.6246709137592923|                  0.25|                          null|                      3|                      0.0|                   36.0|                    null|                  0.0|               null|                1.0|                      1.0|   15.588457268119894|                     0.0|               0|                  0.0|                           3.0|                1.0|15.588457268119894|                         1.0|                  -1.0|                 1.0|                 0.0|        2380664|                       0.0|                       0.0|                      0.0|                        0.0|                           1.0|                        0.0| 1.9411544725836023|\n",
      "+--------------------------+------------+----------------------+------------+-----------------------------+-------------------+------------+-------------+----------------------+--------------+--------------------------+--------------------------+------------------------+----------------------+-----------------------+------------------------------+--------------------------+--------------------+-------------+---------------------------------+------------------+--------------+-----------------------------+----+---------------------------+------------------------+---------------------+-----------------------+----------------+----------------------+-----------------------+----------------------+---------------------------+-----------------+---------------------+-------------------------+---------------+-------------------+----------------------+------------------------------+-----------------------+-------------------------+-----------------------+------------------------+---------------------+-------------------+-------------------+-------------------------+---------------------+------------------------+----------------+---------------------+------------------------------+-------------------+------------------+----------------------------+----------------------+--------------------+--------------------+---------------+--------------------------+--------------------------+-------------------------+---------------------------+------------------------------+---------------------------+-------------------+\n",
      "only showing top 5 rows\n",
      "\n"
     ]
    }
   ],
   "source": [
    "df02.show(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['company', 'shixin_label', 'litigant_defendant_cnt', 'zczj', 'net_share_judge_doc_upper_cnt', 'province_shixin_cnt', 'province_woe', 'hy_normal_cnt', 'net_share_judgedoc_cnt', 'hy_normal_rate', 'litigant_defendant_cnt_coc', 'net_fr_judge_doc_upper_cnt', 'net_fr_judge_doc_cnt_coc', 'network_shixin_cnt_coc', 'network_zhixing_cnt_coc', 'net_senior_judge_doc_upper_cnt', 'litigant_defendant_cnt_rhl', 'share_change_cnt_coc', 'fr_change_cnt', 'net_share_judge_defendant_all_cnt', 'network_shixin_cnt', 'share_frost_cv', 'net_share_judge_doc_lower_cnt', 'clnx', 'net_share_judge_doc_cnt_coc', 'network_fr_shixin_cnt_cv', 'network_fr_shixin_cnt', 'net_share_judge_doc_rhl', 'province_all_cnt', 'network_fr_zhixing_cnt', 'network_pos_zhixing_cnt', 'network_pos_shixin_cnt', 'network_share_shixin_cnt_cv', 'regcap_change_cnt', 'share_frost_lower_cnt', 'litigant_defendant_cnt_cv', 'zczj_shixin_cnt', 'clnx_woe', 'net_share_judge_doc_cv', 'net_fr_judge_defendant_all_cnt', 'net_senior_judgedoc_cnt', 'network_share_zhixing_cnt', 'network_zhixing_cnt_rhl', 'net_invest_judge_doc_rhl', 'regcap_change_cnt_coc', 'net_fr_judgedoc_cnt', 'network_zhixing_cnt', 'network_fr_zhixing_cnt_cv', 'address_change_cnt_cv', 'network_share_shixin_cnt', 'share_change_cnt', 'regcap_change_cnt_rhl', 'net_senior_judge_doc_lower_cnt', 'share_change_cnt_cv', 'fr_change_cnt_cv', 'network_share_zhixing_cnt_cv', 'address_change_cnt_coc', 'regcap_change_cnt_cv', 'share_change_cnt_rhl', 'clnx_fw_all_cnt', 'network_company_shixin_cnt', 'network_pos_shixin_cnt_coc', 'network_fr_shixin_cnt_rhl', 'network_company_zhixing_cnt', 'network_company_zhixing_cnt_cv', 'network_pos_zhixing_cnt_coc', 'zczj_woe']\n"
     ]
    }
   ],
   "source": [
    "print(df02.columns)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 方案一：通过将pyspark的dataframe转为pandas的dataframe 通过tosql存入数据库，数据量小，可行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+------------+--------+\n",
      "|shixin_label|count(1)|\n",
      "+------------+--------+\n",
      "|           0|  165900|\n",
      "|           1|   41562|\n",
      "+------------+--------+\n",
      "\n"
     ]
    }
   ],
   "source": [
    "spark.sql(\"\"\" select shixin_label,count(1) from  train group by shixin_label\"\"\").show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+------------+--------+\n",
      "|shixin_label|count(1)|\n",
      "+------------+--------+\n",
      "|           1| 4275942|\n",
      "|           2|  389081|\n",
      "+------------+--------+\n",
      "\n"
     ]
    }
   ],
   "source": [
    "spark.sql(\"\"\" select shixin_label,count(1) from  features group by shixin_label\"\"\").show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pyspark.sql.dataframe.DataFrame"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(df_all_features)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 把缺失值填充为-1\n",
    "# spark里面不能对对象进行直接处理，只能处理过后生成新的对象\n",
    "df_all_features = df_all_features.na.fill('-1')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "+------------------------------------+------------+-------------------+---------------------+---------------------+-------------------+---------------+--------------+--------------------+----------------------+----------------------+--------------------+-----------------------+-------------------------+-------------------------+-----------------------+----+----+---------------+---------------+----------------+----------------+--------+-------+-------------+-------------+--------------+--------------+----------+------+-----+------------+---------------+----------------+----------------+--------+-------+--------------+-----------------+------------------+------------------+----------+---------+----------------+-------------------+--------------------+--------------------+------------+-----------+----------------------+---------------------------------+-----------------------------+-----------------------------+-----------------------+---------------------------+----------------------+-----------------------+----------------------------------+------------------------------+------------------------------+------------------------+----------------------------+-----------------------+-------------------+------------------------------+--------------------------+\n",
      "|                             company|shixin_label|share_frost_all_cnt|share_frost_upper_cnt|share_frost_lower_cnt|share_frost_cnt_coc|share_frost_rhl|share_frost_cv|share_impawn_all_cnt|share_impawn_upper_cnt|share_impawn_lower_cnt|share_impawn_cnt_coc|shares_transfer_all_cnt|shares_transfer_upper_cnt|shares_transfer_lower_cnt|shares_transfer_cnt_coc|zczj|clnx|clnx_shixin_cnt|clnx_fw_all_cnt|clnx_normal_rate|clnx_shixin_rate|clnx_woe|clnx_iv|hy_normal_cnt|hy_shixin_cnt|hy_normal_rate|hy_shixin_rate|hy_all_cnt|hy_woe|hy_iv|zczj_all_cnt|zczj_shixin_cnt|zczj_normal_rate|zczj_shixin_rate|zczj_woe|zczj_iv|zczjbz_all_cnt|zczjbz_shixin_cnt|zczjbz_normal_rate|zczjbz_shixin_rate|zczjbz_woe|zczjbz_iv|province_all_cnt|province_shixin_cnt|province_normal_rate|province_shixin_rate|province_woe|province_iv|net_share_judgedoc_cnt|net_share_judge_defendant_all_cnt|net_share_judge_doc_upper_cnt|net_share_judge_doc_lower_cnt|net_share_judge_doc_rhl|net_share_judge_doc_cnt_coc|net_share_judge_doc_cv|net_senior_judgedoc_cnt|net_senior_judge_defendant_all_cnt|net_senior_judge_doc_upper_cnt|net_senior_judge_doc_lower_cnt|net_senior_judge_doc_rhl|net_senior_judge_doc_cnt_coc|net_senior_judge_doc_cv|net_fr_judgedoc_cnt|net_fr_judge_defendant_all_cnt|net_fr_judge_doc_upper_cnt|\n",
      "+------------------------------------+------------+-------------------+---------------------+---------------------+-------------------+---------------+--------------+--------------------+----------------------+----------------------+--------------------+-----------------------+-------------------------+-------------------------+-----------------------+----+----+---------------+---------------+----------------+----------------+--------+-------+-------------+-------------+--------------+--------------+----------+------+-----+------------+---------------+----------------+----------------+--------+-------+--------------+-----------------+------------------+------------------+----------+---------+----------------+-------------------+--------------------+--------------------+------------+-----------+----------------------+---------------------------------+-----------------------------+-----------------------------+-----------------------+---------------------------+----------------------+-----------------------+----------------------------------+------------------------------+------------------------------+------------------------+----------------------------+-----------------------+-------------------+------------------------------+--------------------------+\n",
      "|          无锡东灵汇医用技术有限公司|           1|                 -1|                   -1|                   -1|                 -1|             -1|            -1|                  -1|                    -1|                    -1|                  -1|                     -1|                       -1|                       -1|                     -1|  -1|  -1|             -1|             -1|              -1|              -1|      -1|     -1|           -1|           -1|          7340|            js| 20.000000|     0|    7|           1|              0|               0|               0|       0|      0|             0|                0|                 0|                 0|         0|        0|               0|                  0|                   0|                   0|           0|          0|                     0|                                0|                            0|                            0|                      0|                          0|                     0|                      0|                                 0|                             0|                             0|                       0|                           0|                      0|                  0|                             0|                         0|\n",
      "|无锡买卖宝信息技术有限公司北京分公司|           1|                 -1|                   -1|                   -1|                 -1|             -1|            -1|                  -1|                    -1|                    -1|                  -1|                     -1|                       -1|                       -1|                     -1|  -1|  -1|             -1|             -1|              -1|              -1|      -1|     -1|           -1|           -1|          6599|            bj|  0.000000|   156|    8|           0|              0|               0|               0|       0|      0|             0|                0|                 0|                 0|         0|        0|               0|                  0|                   0|                   0|           0|          0|                     0|                                0|                            0|                            0|                      0|                          0|                     0|                      0|                                 0|                             0|                             0|                       0|                           0|                      0|                  0|                            13|                      4.33|\n",
      "|                无锡互联贸易有限公司|           1|                 -1|                   -1|                   -1|                 -1|             -1|            -1|                  -1|                    -1|                    -1|                  -1|                     -1|                       -1|                       -1|                     -1|  -1|  -1|             -1|             -1|              -1|              -1|      -1|     -1|           -1|           -1|            51|            js| 52.000000|     0|   15|           0|              1|               0|               0|       0|      0|             0|                0|                 0|                 0|         0|        0|               0|                  0|                   0|                   0|           0|          0|                     0|                                0|                            0|                            0|                      0|                          0|                     0|                      0|                                 0|                             0|                             0|                       0|                           0|                      0|                  0|                             0|                         0|\n",
      "|            无锡五洲物业管理有限公司|           1|                  1|                    5|                    0|                  0|              0|             0|                   3|                     0|                     0|                   0|                      0|                        0|                        1|                      0|   0|   0|              0|              0|               0|               0|       0|      1|            1|            0|          7020|            js|500.000000|     0|   13|           1|              0|               2|               0|       0|      0|             0|                0|                 0|                 1|         0|        0|               0|                  0|                   0|                   0|           0|          0|                     0|                                0|                            0|                            0|                      0|                          0|                     0|                      0|                                 0|                             0|                             0|                       0|                           0|                      0|                  0|                             0|                         0|\n",
      "|          无锡亚东硫化器制造有限公司|           1|                 -1|                   -1|                   -1|                 -1|             -1|            -1|                  -1|                    -1|                    -1|                  -1|                     -1|                       -1|                       -1|                     -1|  -1|  -1|             -1|             -1|              -1|              -1|      -1|     -1|           -1|           -1|            34|            js|528.000000|     0|   21|           0|              1|               2|               0|       0|      0|             0|                0|                 0|                 0|         0|        0|               0|                  0|                   0|                   0|           0|          0|                     0|                                0|                            0|                            0|                      0|                          0|                     0|                      0|                                 0|                             0|                             0|                       0|                           0|                      0|                  0|                             0|                         0|\n",
      "+------------------------------------+------------+-------------------+---------------------+---------------------+-------------------+---------------+--------------+--------------------+----------------------+----------------------+--------------------+-----------------------+-------------------------+-------------------------+-----------------------+----+----+---------------+---------------+----------------+----------------+--------+-------+-------------+-------------+--------------+--------------+----------+------+-----+------------+---------------+----------------+----------------+--------+-------+--------------+-----------------+------------------+------------------+----------+---------+----------------+-------------------+--------------------+--------------------+------------+-----------+----------------------+---------------------------------+-----------------------------+-----------------------------+-----------------------+---------------------------+----------------------+-----------------------+----------------------------------+------------------------------+------------------------------+------------------------+----------------------------+-----------------------+-------------------+------------------------------+--------------------------+\n",
      "only showing top 5 rows\n",
      "\n"
     ]
    }
   ],
   "source": [
    "df_all_features.show(5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# dataframe写入postgresql数据库中"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sqlalchemy import create_engine\n",
    "engine_str = 'postgresql://yxl:123456@180.76.159.157:5432/postgres'\n",
    "engine = create_engine(engine_str\n",
    "                       ) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "df03 = df02.toPandas()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1000, 67)"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df03.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "df03.to_sql(\"org_scord_card\", engine, schema='orgrisk', index=False,\n",
    "                    if_exists='append')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "import io\n",
    "def db_copy_from(df_a, table_name, sep='\\001', quotechar=\"\\002\"):\n",
    "    \"\"\"\n",
    "    sep: 分隔符，\n",
    "    quotechar：字符串（长度为1），默认为“”，用于引用字段的字符\n",
    "    COPY_FROM说明：\n",
    "    copy_from（file，table，sep ='\\t', null =' ',size = 8192,columns = None ）\n",
    "    从类似文件的目标文件中读取数据，将它们附加到名为table的表中。\n",
    "    file - 从中读取数据的类文件对象。它必须具有 read()和readline()方法。\n",
    "    table - 要将数据复制到的表的名称。\n",
    "    sep - 文件中预期的列分隔符。默认为选项卡。\n",
    "    null - NULL文件中的文本表示。默认为两个字符串 。\n",
    "    size - 用于从文件中读取的缓冲区的大小。\n",
    "    columns - 可以使用要导入的列的名称进行迭代。\n",
    "    长度和类型应与要读取的文件的内容相匹配。\n",
    "    如果未指定，则假定整个表与文件结构匹配。\n",
    "    \"\"\" \n",
    "    if df_a.shape[0] < 4: \n",
    "        df_a.to_sql(table_name, engine, schema='orgrisk', index=False,\n",
    "                    if_exists='append')\n",
    "    else: \n",
    "        columns = ['company', 'shixin_label', 'litigant_defendant_cnt', 'zczj', 'net_share_judge_doc_upper_cnt', 'province_shixin_cnt', 'province_woe', 'hy_normal_cnt', 'net_share_judgedoc_cnt', 'hy_normal_rate', 'litigant_defendant_cnt_coc', 'net_fr_judge_doc_upper_cnt', 'net_fr_judge_doc_cnt_coc', 'network_shixin_cnt_coc', 'network_zhixing_cnt_coc', 'net_senior_judge_doc_upper_cnt', 'litigant_defendant_cnt_rhl', 'share_change_cnt_coc', 'fr_change_cnt', 'net_share_judge_defendant_all_cnt', 'network_shixin_cnt', 'share_frost_cv', 'net_share_judge_doc_lower_cnt', 'clnx', 'net_share_judge_doc_cnt_coc', 'network_fr_shixin_cnt_cv', 'network_fr_shixin_cnt', 'net_share_judge_doc_rhl', 'province_all_cnt', 'network_fr_zhixing_cnt', 'network_pos_zhixing_cnt', 'network_pos_shixin_cnt', 'network_share_shixin_cnt_cv', 'regcap_change_cnt', 'share_frost_lower_cnt', 'litigant_defendant_cnt_cv', 'zczj_shixin_cnt', 'clnx_woe', 'net_share_judge_doc_cv', 'net_fr_judge_defendant_all_cnt', 'net_senior_judgedoc_cnt', 'network_share_zhixing_cnt', 'network_zhixing_cnt_rhl', 'net_invest_judge_doc_rhl', 'regcap_change_cnt_coc', 'net_fr_judgedoc_cnt', 'network_zhixing_cnt', 'network_fr_zhixing_cnt_cv', 'address_change_cnt_cv', 'network_share_shixin_cnt', 'share_change_cnt', 'regcap_change_cnt_rhl', 'net_senior_judge_doc_lower_cnt', 'share_change_cnt_cv', 'fr_change_cnt_cv', 'network_share_zhixing_cnt_cv', 'address_change_cnt_coc', 'regcap_change_cnt_cv', 'share_change_cnt_rhl', 'clnx_fw_all_cnt', 'network_company_shixin_cnt', 'network_pos_shixin_cnt_coc', 'network_fr_shixin_cnt_rhl', 'network_company_zhixing_cnt', 'network_company_zhixing_cnt_cv', 'network_pos_zhixing_cnt_coc', 'zczj_woe']\n",
    "        try:\n",
    "            output = io.StringIO()\n",
    "            # ignore the index\n",
    "            df_a.to_csv(output, sep=sep, index=False, header=False, quotechar=quotechar)\n",
    "            output = output.getvalue()\n",
    "            # jump to start of stream\n",
    "            # output.seek(0)\n",
    "            connection = engine.raw_connection()  # engine 是 from sqlalchemy import create_engine\n",
    "            cursor = connection.cursor()\n",
    "            # null value become '' 快100倍\n",
    "            cursor.copy_from(io.StringIO(output), \"orgrisk.\" + table_name, sep=sep, null='', columns=columns)\n",
    "            connection.commit()\n",
    "            cursor.close()\n",
    "        except:\n",
    "            import traceback\n",
    "            traceback.print_exc()\n",
    "            df_a.to_sql(table_name, engine, schema='orgrisk', index=False,\n",
    "                        if_exists='append')\n",
    "            pass \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " ## 建人工黑名单"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wall time: 1.95 s\n"
     ]
    }
   ],
   "source": [
    "%time db_copy_from(df03, \"scored_blacklist\", sep='\\001', quotechar=\"\\002\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 方案二 对于特别大的数据集可以采用先save的方式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "df02.repartition(2).write.save(hdfspath+\"/qiye/org_scord_card.csv\", format=\"csv\", mode=\"overwrite\", header=False, delimiter=',')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    " hadoop fs -getmerge hdfs://127.0.0.1:9000/qiye/\"org_scord_card.csv\" E:\\\\prod\\\\UserScoreCard\\\\data\\\\org_scord_card.csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python [conda env:venv]",
   "language": "python",
   "name": "conda-env-venv-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
